home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / congo.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  21KB  |  554 lines

  1. /***************************************************************************
  2.  
  3. Congo Bongo memory map (preliminary)
  4.  
  5. 0000-1fff ROM 1
  6. 2000-3fff ROM 2
  7. 4000-5fff ROM 3
  8. 6000-7fff ROM 4
  9.  
  10. 8000-87ff RAM 1
  11. 8800-8fff RAM 2
  12. a000-a3ff Video RAM
  13. a400-a7ff Color RAM
  14.  
  15. 8400-8fff sprites
  16.  
  17. read:
  18. c000      IN0
  19. c001      IN1
  20. c002      DSW1
  21. c003      DSW2
  22. c008      IN2
  23.  
  24. write:
  25. c000-c002 ?
  26. c006      ?
  27. c018      coinAen, used to enable input on coin slot A
  28. c019      coinBen, used to enable input on coin slot B
  29. c01a      serven,  used to enable input on service sw
  30. c01b      counterA,coin counter for slot A
  31. c01c      counterB,coin counter for slot B
  32. c01d      background enable
  33. c01e      flip screen
  34. c01f      interrupt enable
  35.  
  36. c028-c029 background playfield position
  37. c031      sprite enable ?
  38. c032      sprite start
  39. c033      sprite count
  40.  
  41.  
  42. interrupts:
  43. VBlank triggers IRQ, handled with interrupt mode 1
  44. NMI causes a ROM/RAM test.
  45.  
  46. ***************************************************************************/
  47.  
  48. #include "driver.h"
  49. #include "vidhrdw/generic.h"
  50.  
  51. extern struct GfxLayout zaxxon_charlayout1;
  52. extern struct GfxLayout zaxxon_charlayout2;
  53.  
  54. extern int zaxxon_vid_type;
  55. extern unsigned char *zaxxon_background_position;
  56. extern unsigned char *zaxxon_background_enable;
  57. void zaxxon_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  58. int  zaxxon_vh_start(void);
  59. void zaxxon_vh_stop(void);
  60. void zaxxon_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  61.  
  62.  
  63.  
  64. void congo_init_machine(void)
  65. {
  66.     zaxxon_vid_type = 1;
  67. }
  68.  
  69. WRITE_HANDLER( congo_daio_w )
  70. {
  71.     if (offset == 1)
  72.     {
  73.         if (data & 2) sample_start(0,0,0);
  74.     }
  75.     else if (offset == 2)
  76.     {
  77.         data ^= 0xff;
  78.  
  79.         if (data & 0x80)
  80.         {
  81.             if (data & 8) sample_start(1,1,0);
  82.             if (data & 4) sample_start(2,2,0);
  83.             if (data & 2) sample_start(3,3,0);
  84.             if (data & 1) sample_start(4,4,0);
  85.         }
  86.     }
  87. }
  88.  
  89.  
  90. static struct MemoryReadAddress readmem[] =
  91. {
  92.     { 0x8000, 0x8fff, MRA_RAM },
  93.     { 0xa000, 0x83ff, MRA_RAM },
  94.     { 0xa000, 0xa7ff, MRA_RAM },
  95.     { 0xc000, 0xc000, input_port_0_r },
  96.     { 0xc001, 0xc001, input_port_1_r },
  97.     { 0xc008, 0xc008, input_port_2_r },
  98.     { 0xc002, 0xc002, input_port_3_r },
  99.     { 0xc003, 0xc003, input_port_4_r },
  100.     { 0x0000, 0x7fff, MRA_ROM },
  101.     { -1 }  /* end of table */
  102. };
  103.  
  104. static struct MemoryWriteAddress writemem[] =
  105. {
  106.     { 0x8000, 0x83ff, MWA_RAM },
  107.     { 0xa000, 0xa3ff, videoram_w, &videoram, &videoram_size },
  108.     { 0xa400, 0xa7ff, colorram_w, &colorram },
  109.     { 0x8400, 0x8fff, MWA_RAM, &spriteram },
  110.     { 0xc01f, 0xc01f, interrupt_enable_w },
  111.     { 0xc028, 0xc029, MWA_RAM, &zaxxon_background_position },
  112.     { 0xc01d, 0xc01d, MWA_RAM, &zaxxon_background_enable },
  113.     { 0xc038, 0xc038, soundlatch_w },
  114.     { 0xc030, 0xc033, MWA_NOP }, /* ??? */
  115.     { 0xc01e, 0xc01e, MWA_NOP }, /* flip unused for now */
  116.     { 0xc018, 0xc018, MWA_NOP }, /* coinAen */
  117.     { 0xc019, 0xc019, MWA_NOP }, /* coinBen */
  118.     { 0xc01a, 0xc01a, MWA_NOP }, /* serven */
  119.     { 0xc01b, 0xc01c, coin_counter_w }, /* counterA, counterB */
  120.     { 0x0000, 0x7fff, MWA_ROM },
  121.     { -1 }  /* end of table */
  122. };
  123.  
  124.  
  125. static struct MemoryReadAddress sh_readmem[] =
  126. {
  127.     { 0x0000, 0x1fff, MRA_ROM },
  128.     { 0x4000, 0x47ff, MRA_RAM },
  129.     { 0x8000, 0x8003, soundlatch_r },
  130.     { -1 }
  131. };
  132. static struct MemoryWriteAddress sh_writemem[] =
  133. {
  134.     { 0x6000, 0x6003, SN76496_0_w },
  135.     { 0xa000, 0xa003, SN76496_1_w },
  136.     { 0x4000, 0x47ff, MWA_RAM },
  137.     { 0x8000, 0x8003, congo_daio_w },
  138.     { 0x0000, 0x2000, MWA_ROM },
  139.     { -1 }
  140. };
  141.  
  142.  
  143.  
  144. /***************************************************************************
  145.  
  146.   Congo Bongo uses NMI to trigger the self test. We use a fake input port
  147.   to tie that event to a keypress.
  148.  
  149. ***************************************************************************/
  150. static int congo_interrupt(void)
  151. {
  152.     if (readinputport(5) & 1)    /* get status of the F2 key */
  153.         return nmi_interrupt();    /* trigger self test */
  154.     else return interrupt();
  155. }
  156.  
  157. /* almost the same as Zaxxon; UP and DOWN are inverted, and the joystick is 4 way. */
  158. INPUT_PORTS_START( congo )
  159.     PORT_START    /* IN0 */
  160.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  161.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  162.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  163.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  164.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  165.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  166.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  167.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  168.  
  169.     PORT_START    /* IN1 */
  170.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  171.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  172.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  173.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  174.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  175.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  176.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  177.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  178.  
  179.     PORT_START    /* IN2 */
  180.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  181.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  182.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  183.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  184.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  185.     /* the coin inputs must stay active for exactly one frame, otherwise */
  186.     /* the game will keep inserting coins. */
  187.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  188.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  189.     /* Coin Aux doesn't need IMPULSE to pass the test, but it still needs it */
  190.     /* to avoid the freeze. */
  191.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1, 1 )
  192.  
  193.     PORT_START    /* DSW0 */
  194.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
  195.     PORT_DIPSETTING(    0x03, "10000" )
  196.     PORT_DIPSETTING(    0x01, "20000" )
  197.     PORT_DIPSETTING(    0x02, "30000" )
  198.     PORT_DIPSETTING(    0x00, "40000" )
  199.     PORT_DIPNAME( 0x0c, 0x0c, "Difficulty???" )
  200.     PORT_DIPSETTING(    0x0c, "Easy?" )
  201.     PORT_DIPSETTING(    0x04, "Medium?" )
  202.     PORT_DIPSETTING(    0x08, "Hard?" )
  203.     PORT_DIPSETTING(    0x00, "Hardest?" )
  204.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  205.     PORT_DIPSETTING(    0x30, "3" )
  206.     PORT_DIPSETTING(    0x10, "4" )
  207.     PORT_DIPSETTING(    0x20, "5" )
  208.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  209.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
  210.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  211.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  212.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  213.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  214.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  215.  
  216.     PORT_START    /* DSW1 */
  217.     PORT_DIPNAME( 0x0f, 0x03, DEF_STR( Coin_B ) )
  218.     PORT_DIPSETTING(    0x0f, DEF_STR( 4C_1C ) )
  219.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_1C ) )
  220.     PORT_DIPSETTING(    0x0b, DEF_STR( 2C_1C ) )
  221.     PORT_DIPSETTING(    0x06, "2C/1C 5C/3C 6C/4C" )
  222.     PORT_DIPSETTING(    0x0a, "2C/1C 3C/2C 4C/3C" )
  223.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  224.     PORT_DIPSETTING(    0x02, "1C/1C 5C/6C" )
  225.     PORT_DIPSETTING(    0x0c, "1C/1C 4C/5C" )
  226.     PORT_DIPSETTING(    0x04, "1C/1C 2C/3C" )
  227.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_2C ) )
  228.     PORT_DIPSETTING(    0x08, "1C/2C 5C/11C" )
  229.     PORT_DIPSETTING(    0x00, "1C/2C 4C/9C" )
  230.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  231.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_4C ) )
  232.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_5C ) )
  233.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_6C ) )
  234.     PORT_DIPNAME( 0xf0, 0x30, DEF_STR( Coin_A ) )
  235.     PORT_DIPSETTING(    0xf0, DEF_STR( 4C_1C ) )
  236.     PORT_DIPSETTING(    0x70, DEF_STR( 3C_1C ) )
  237.     PORT_DIPSETTING(    0xb0, DEF_STR( 2C_1C ) )
  238.     PORT_DIPSETTING(    0x60, "2C/1C 5C/3C 6C/4C" )
  239.     PORT_DIPSETTING(    0xa0, "2C/1C 3C/2C 4C/3C" )
  240.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  241.     PORT_DIPSETTING(    0x20, "1C/1C 5C/6C" )
  242.     PORT_DIPSETTING(    0xc0, "1C/1C 4C/5C" )
  243.     PORT_DIPSETTING(    0x40, "1C/1C 2C/3C" )
  244.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_2C ) )
  245.     PORT_DIPSETTING(    0x80, "1C/2C 5C/11C" )
  246.     PORT_DIPSETTING(    0x00, "1C/2C 4C/9C" )
  247.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_3C ) )
  248.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_4C ) )
  249.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_5C ) )
  250.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_6C ) )
  251.  
  252.     PORT_START    /* FAKE */
  253.     /* This fake input port is used to get the status of the F2 key, */
  254.     /* and activate the test mode, which is triggered by a NMI */
  255.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  256. INPUT_PORTS_END
  257.  
  258. /* Same as Congo Bongo, except the Demo Sounds dip, that here turns the
  259.    sound off in the whole game. */
  260. INPUT_PORTS_START( tiptop )
  261.     PORT_START    /* IN0 */
  262.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  263.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  264.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  265.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  266.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  267.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  268.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  269.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  270.  
  271.     PORT_START    /* IN1 */
  272.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  273.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  274.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  275.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  276.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  277.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  278.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  279.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  280.  
  281.     PORT_START    /* IN2 */
  282.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  283.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  284.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  285.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  286.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused (the self test doesn't mention it) */
  287.     /* the coin inputs must stay active for exactly one frame, otherwise */
  288.     /* the game will keep inserting coins. */
  289.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  290.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  291.     /* Coin Aux doesn't need IMPULSE to pass the test, but it still needs it */
  292.     /* to avoid the freeze. */
  293.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE1, 1 )
  294.  
  295.     PORT_START    /* DSW0 */
  296.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
  297.     PORT_DIPSETTING(    0x03, "10000" )
  298.     PORT_DIPSETTING(    0x01, "20000" )
  299.     PORT_DIPSETTING(    0x02, "30000" )
  300.     PORT_DIPSETTING(    0x00, "40000" )
  301.     PORT_DIPNAME( 0x0c, 0x0c, "Difficulty???" )
  302.     PORT_DIPSETTING(    0x0c, "Easy?" )
  303.     PORT_DIPSETTING(    0x04, "Medium?" )
  304.     PORT_DIPSETTING(    0x08, "Hard?" )
  305.     PORT_DIPSETTING(    0x00, "Hardest?" )
  306.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
  307.     PORT_DIPSETTING(    0x30, "3" )
  308.     PORT_DIPSETTING(    0x10, "4" )
  309.     PORT_DIPSETTING(    0x20, "5" )
  310.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  311.     PORT_DIPNAME( 0x40, 0x40, "Sound" )
  312.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  313.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  314.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
  315.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  316.     PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
  317.  
  318.     PORT_START    /* DSW1 */
  319.     PORT_DIPNAME( 0x0f, 0x03, DEF_STR( Coin_B ) )
  320.     PORT_DIPSETTING(    0x0f, DEF_STR( 4C_1C ) )
  321.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_1C ) )
  322.     PORT_DIPSETTING(    0x0b, DEF_STR( 2C_1C ) )
  323.     PORT_DIPSETTING(    0x06, "2C/1C 5C/3C 6C/4C" )
  324.     PORT_DIPSETTING(    0x0a, "2C/1C 3C/2C 4C/3C" )
  325.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  326.     PORT_DIPSETTING(    0x02, "1C/1C 5C/6C" )
  327.     PORT_DIPSETTING(    0x0c, "1C/1C 4C/5C" )
  328.     PORT_DIPSETTING(    0x04, "1C/1C 2C/3C" )
  329.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_2C ) )
  330.     PORT_DIPSETTING(    0x08, "1C/2C 5C/11C" )
  331.     PORT_DIPSETTING(    0x00, "1C/2C 4C/9C" )
  332.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  333.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_4C ) )
  334.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_5C ) )
  335.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_6C ) )
  336.     PORT_DIPNAME( 0xf0, 0x30, DEF_STR( Coin_A ) )
  337.     PORT_DIPSETTING(    0xf0, DEF_STR( 4C_1C ) )
  338.     PORT_DIPSETTING(    0x70, DEF_STR( 3C_1C ) )
  339.     PORT_DIPSETTING(    0xb0, DEF_STR( 2C_1C ) )
  340.     PORT_DIPSETTING(    0x60, "2C/1C 5C/3C 6C/4C" )
  341.     PORT_DIPSETTING(    0xa0, "2C/1C 3C/2C 4C/3C" )
  342.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  343.     PORT_DIPSETTING(    0x20, "1C/1C 5C/6C" )
  344.     PORT_DIPSETTING(    0xc0, "1C/1C 4C/5C" )
  345.     PORT_DIPSETTING(    0x40, "1C/1C 2C/3C" )
  346.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_2C ) )
  347.     PORT_DIPSETTING(    0x80, "1C/2C 5C/11C" )
  348.     PORT_DIPSETTING(    0x00, "1C/2C 4C/9C" )
  349.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_3C ) )
  350.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_4C ) )
  351.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_5C ) )
  352.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_6C ) )
  353.  
  354.     PORT_START    /* FAKE */
  355.     /* This fake input port is used to get the status of the F2 key, */
  356.     /* and activate the test mode, which is triggered by a NMI */
  357.     PORT_BITX(0x01, IP_ACTIVE_HIGH, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  358. INPUT_PORTS_END
  359.  
  360.  
  361. static struct GfxLayout spritelayout =
  362. {
  363.     32,32,    /* 32*32 sprites */
  364.     128,    /* 128 sprites */
  365.     3,    /* 3 bits per pixel */
  366.     { 2*128*128*8, 128*128*8, 0 },    /* the bitplanes are separated */
  367.     { 0, 1, 2, 3, 4, 5, 6, 7,
  368.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
  369.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  370.             24*8+0, 24*8+1, 24*8+2, 24*8+3, 24*8+4, 24*8+5, 24*8+6, 24*8+7 },
  371.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  372.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8,
  373.             64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8,
  374.             96*8, 97*8, 98*8, 99*8, 100*8, 101*8, 102*8, 103*8 },
  375.     128*8    /* every sprite takes 128 consecutive bytes */
  376. };
  377.  
  378.  
  379. static struct GfxDecodeInfo gfxdecodeinfo[] =
  380. {
  381.     { REGION_GFX1, 0, &zaxxon_charlayout1,  0, 32 },    /* characters */
  382.     { REGION_GFX2, 0, &zaxxon_charlayout2,  0, 32 },    /* background tiles */
  383.     { REGION_GFX3, 0, &spritelayout,        0, 32 },    /* sprites */
  384.     { -1 } /* end of array */
  385. };
  386.  
  387.  
  388.  
  389. static struct SN76496interface sn76496_interface =
  390. {
  391.     2,    /* 2 chips */
  392.     { 4000000, 4000000 },    /* 4 Mhz??? */
  393.     { 100, 100 }
  394. };
  395.  
  396. /* Samples for Congo Bongo, these are needed for now    */
  397. /* as I haven't gotten around to calculate a formula for the */
  398. /* simple oscillators producing the drums VL*/
  399. /* As for now, thanks to Tim L. for providing samples */
  400.  
  401. static const char *congo_sample_names[] =
  402. {
  403.     "*congo",
  404.     "gorilla.wav",
  405.     "bass.wav",
  406.     "congaa.wav",
  407.     "congab.wav",
  408.     "rim.wav",
  409.     0
  410. };
  411.  
  412. static struct Samplesinterface samples_interface =
  413. {
  414.     5,    /* 5 channels */
  415.     25,    /* volume */
  416.     congo_sample_names
  417. };
  418.  
  419.  
  420.  
  421. static struct MachineDriver machine_driver_congo =
  422. {
  423.     /* basic machine hardware */
  424.     {
  425.         {
  426.             CPU_Z80,
  427.             3072000,    /* 3.072 Mhz ?? */
  428.             readmem,writemem,0,0,
  429.             congo_interrupt,1
  430.         },
  431.         {
  432.             CPU_Z80 | CPU_AUDIO_CPU,
  433.             2000000,
  434.             sh_readmem, sh_writemem, 0,0,
  435.             interrupt, 4
  436.         }
  437.     },
  438.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  439.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  440.     congo_init_machine,
  441.  
  442.     /* video hardware */
  443.     32*8, 32*8, { 0*8, 32*8-1,2*8, 30*8-1 },
  444.     gfxdecodeinfo,
  445.     256,32*8,
  446.     zaxxon_vh_convert_color_prom,
  447.  
  448.     VIDEO_TYPE_RASTER,
  449.     0,
  450.     zaxxon_vh_start,
  451.     zaxxon_vh_stop,
  452.     zaxxon_vh_screenrefresh,
  453.  
  454.     /* sound hardware */
  455.     0,0,0,0,
  456.     {
  457.         {
  458.             SOUND_SN76496,
  459.             &sn76496_interface
  460.         },
  461.         {
  462.             SOUND_SAMPLES,
  463.             &samples_interface
  464.         }
  465.     }
  466. };
  467.  
  468.  
  469.  
  470. /***************************************************************************
  471.  
  472.   Game driver(s)
  473.  
  474. ***************************************************************************/
  475.  
  476. ROM_START( congo )
  477.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  478.     ROM_LOAD( "congo1.bin",   0x0000, 0x2000, 0x09355b5b )
  479.     ROM_LOAD( "congo2.bin",   0x2000, 0x2000, 0x1c5e30ae )
  480.     ROM_LOAD( "congo3.bin",   0x4000, 0x2000, 0x5ee1132c )
  481.     ROM_LOAD( "congo4.bin",   0x6000, 0x2000, 0x5332b9bf )
  482.  
  483.     ROM_REGION( 0x10000, REGION_CPU2 ) /*64K for the sound cpu*/
  484.     ROM_LOAD( "congo17.bin",  0x0000, 0x2000, 0x5024e673 )
  485.  
  486.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  487.     ROM_LOAD( "congo5.bin",   0x00000, 0x1000, 0x7bf6ba2b )    /* characters */
  488.     /* 1000-1800 empty space to convert the characters as 3bpp instead of 2 */
  489.  
  490.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  491.     ROM_LOAD( "congo8.bin",   0x00000, 0x2000, 0xdb99a619 )    /* background tiles */
  492.     ROM_LOAD( "congo9.bin",   0x02000, 0x2000, 0x93e2309e )
  493.     ROM_LOAD( "congo10.bin",  0x04000, 0x2000, 0xf27a9407 )
  494.  
  495.     ROM_REGION( 0xc000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  496.     ROM_LOAD( "congo12.bin",  0x00000, 0x2000, 0x15e3377a )    /* sprites */
  497.     ROM_LOAD( "congo13.bin",  0x02000, 0x2000, 0x1d1321c8 )
  498.     ROM_LOAD( "congo11.bin",  0x04000, 0x2000, 0x73e2709f )
  499.     ROM_LOAD( "congo14.bin",  0x06000, 0x2000, 0xbf9169fe )
  500.     ROM_LOAD( "congo16.bin",  0x08000, 0x2000, 0xcb6d5775 )
  501.     ROM_LOAD( "congo15.bin",  0x0a000, 0x2000, 0x7b15a7a4 )
  502.  
  503.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  504.     ROM_LOAD( "congo6.bin",   0x0000, 0x2000, 0xd637f02b )
  505.     /* 2000-3fff empty space to match Zaxxon */
  506.     ROM_LOAD( "congo7.bin",   0x4000, 0x2000, 0x80927943 )
  507.     /* 6000-7fff empty space to match Zaxxon */
  508.  
  509.     ROM_REGION( 0x0100, REGION_PROMS )
  510.     ROM_LOAD( "congo.u68",    0x0000, 0x100, 0xb788d8ae ) /* palette */
  511. ROM_END
  512.  
  513. ROM_START( tiptop )
  514.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  515.     ROM_LOAD( "tiptop1.bin",  0x0000, 0x2000, 0xe19dc77b )
  516.     ROM_LOAD( "tiptop2.bin",  0x2000, 0x2000, 0x3fcd3b6e )
  517.     ROM_LOAD( "tiptop3.bin",  0x4000, 0x2000, 0x1c94250b )
  518.     ROM_LOAD( "tiptop4.bin",  0x6000, 0x2000, 0x577b501b )
  519.  
  520.     ROM_REGION( 0x10000, REGION_CPU2 ) /*64K for the sound cpu*/
  521.     ROM_LOAD( "congo17.bin",  0x0000, 0x2000, 0x5024e673 )
  522.  
  523.     ROM_REGION( 0x1800, REGION_GFX1 | REGIONFLAG_DISPOSE )
  524.     ROM_LOAD( "congo5.bin",   0x00000, 0x1000, 0x7bf6ba2b )    /* characters */
  525.     /* 1000-1800 empty space to convert the characters as 3bpp instead of 2 */
  526.  
  527.     ROM_REGION( 0x6000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  528.     ROM_LOAD( "congo8.bin",   0x00000, 0x2000, 0xdb99a619 )    /* background tiles */
  529.     ROM_LOAD( "congo9.bin",   0x02000, 0x2000, 0x93e2309e )
  530.     ROM_LOAD( "congo10.bin",  0x04000, 0x2000, 0xf27a9407 )
  531.  
  532.     ROM_REGION( 0xc000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  533.     ROM_LOAD( "congo12.bin",  0x00000, 0x2000, 0x15e3377a )    /* sprites */
  534.     ROM_LOAD( "congo13.bin",  0x02000, 0x2000, 0x1d1321c8 )
  535.     ROM_LOAD( "congo11.bin",  0x04000, 0x2000, 0x73e2709f )
  536.     ROM_LOAD( "congo14.bin",  0x06000, 0x2000, 0xbf9169fe )
  537.     ROM_LOAD( "congo16.bin",  0x08000, 0x2000, 0xcb6d5775 )
  538.     ROM_LOAD( "congo15.bin",  0x0a000, 0x2000, 0x7b15a7a4 )
  539.  
  540.     ROM_REGION( 0x8000, REGION_GFX4 | REGIONFLAG_DISPOSE )    /* background tilemaps converted in vh_start */
  541.     ROM_LOAD( "congo6.bin",   0x0000, 0x2000, 0xd637f02b )
  542.     /* 2000-3fff empty space to match Zaxxon */
  543.     ROM_LOAD( "congo7.bin",   0x4000, 0x2000, 0x80927943 )
  544.     /* 6000-7fff empty space to match Zaxxon */
  545.  
  546.     ROM_REGION( 0x0100, REGION_PROMS )
  547.     ROM_LOAD( "congo.u68",    0x0000, 0x100, 0xb788d8ae ) /* palette */
  548. ROM_END
  549.  
  550.  
  551.  
  552. GAME( 1983, congo,  0,     congo, congo,  0, ROT90, "Sega", "Congo Bongo" )
  553. GAME( 1983, tiptop, congo, congo, tiptop, 0, ROT90, "Sega", "Tip Top" )
  554.